package com.emm.yixun.basic.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.emm.yixun.basic.service.AppPushService;
import com.emm.yixun.basic.service.BusinessAbnormaService;
import com.emm.yixun.basic.service.CusAppPushService;
import com.emm.yixun.basic.service.CustomerService;
import com.emm.yixun.basic.service.DictionaryService;
import com.emm.yixun.basic.service.MessageReceiverService;
import com.emm.yixun.basic.service.NoticeService;
import com.emm.yixun.basic.service.NoticeTemporaryService;
import com.emm.yixun.basic.service.PayDepositService;
import com.emm.yixun.basic.service.PriceSchemeService;
import com.emm.yixun.basic.service.ProjectRoomService;
import com.emm.yixun.basic.service.ProjectService;
import com.emm.yixun.basic.service.ProjectSettingService;
import com.emm.yixun.basic.service.ReserveAreaService;
import com.emm.yixun.basic.service.SignedService;
import com.emm.yixun.basic.service.SubscribeService;
import com.emm.yixun.basic.service.TransactionRelationService;
import com.emm.yixun.basic.service.UserService;
import com.emm.yixun.common.response.Response;
import com.emm.yixun.common.utils.MsgUtil;
import com.emm.yixun.common.enums.ResultEnum;
import com.emm.yixun.common.model.BusinessAbnorma;
import com.emm.yixun.common.model.Customer;
import com.emm.yixun.common.model.Dictionary;
import com.emm.yixun.common.model.PayDeposit;
import com.emm.yixun.common.model.PriceScheme;
import com.emm.yixun.common.model.Project;
import com.emm.yixun.common.model.ProjectRoom;
import com.emm.yixun.common.model.ProjectSetting;
import com.emm.yixun.common.model.ReserveArea;
import com.emm.yixun.common.model.Signed;
import com.emm.yixun.common.model.Subscribe;
import com.emm.yixun.common.model.TransactionRelation;
import com.emm.yixun.common.model.User;
import com.emm.yixun.common.model.dto.BusinessAbnormaDto;
import com.emm.yixun.common.model.dto.DictionaryDto;
import com.emm.yixun.common.model.dto.MessageReceiverDto;
import com.emm.yixun.common.model.dto.NoticeDto;
import com.emm.yixun.common.model.dto.NoticeTemporaryDto;
import com.emm.yixun.common.model.dto.ProjectDto;
import com.emm.yixun.common.model.dto.ProjectSettingDto;
import com.emm.yixun.common.model.dto.ReserveAreaDto;
import com.emm.yixun.common.model.dto.TransactionRelationDto;
import com.emm.yixun.common.model.dto.UserDto;
import com.emm.yixun.common.model.enums.AuditStatusEnum;
import com.emm.yixun.common.model.enums.DelFlagEnum;
import com.emm.yixun.common.model.enums.IsPaydepositEnum;
import com.emm.yixun.common.model.enums.IsReadEnum;
import com.emm.yixun.common.model.enums.IsSendEnum;
import com.emm.yixun.common.model.enums.IsValidEnum;
import com.emm.yixun.common.model.enums.NoticeTypeEnum;
import com.emm.yixun.common.model.enums.ReceiveStatusEnum;
import com.emm.yixun.common.model.enums.ReportMessageEnum;
import com.emm.yixun.common.model.dto.NoticeEntity;

@Service("cusAppPushService")
public class CusAppPushServiceImpl implements CusAppPushService{
	private  final Logger   logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private UserService userService;
	@Autowired
	private DictionaryService dictionaryService;
	@Autowired
	private ProjectRoomService projectRoomService;
	@Autowired
	private CustomerService customerService;
	@Autowired
	private PayDepositService payDepositService;
	@Autowired
	private SubscribeService subscribeService;
	@Autowired
	private SignedService signedService;
	@Autowired
	private NoticeService noticeService;
	@Autowired
	private MessageReceiverService messageReceiverService;
	@Autowired
	private AppPushService appPushService;
	@Autowired
	private ProjectService projectService;
	@Autowired
	private TransactionRelationService transactionRelationService;
	@Autowired
	private BusinessAbnormaService businessAbnormaService;
	@Autowired
	private ProjectSettingService projectSettingService;
	@Autowired
	private PriceSchemeService priceSchemeService;
	@Autowired
	private NoticeTemporaryService noticeTemporaryService;
	@Autowired
	private ReserveAreaService reserveAreaService;
	
	Response<Boolean> response=new Response<Boolean>();

	/**
	 * 组装消息内容
	 * @param noticeEntity
	 * @return
	 */
	public Boolean busNotice(NoticeEntity noticeEntity) {
		/**
		 * 消息推送app业务处理
		 * @author ny
		 */
		try{
			// 认筹审核结果
			if ("1".equals(noticeEntity.getNoticeType())) {
				// 实体对象
				PayDeposit payDeposit = payDepositService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(payDeposit.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				//发起人，及经纪人
				List<User> userList = new ArrayList<User>();
				User user = userService.selectById(payDeposit.getAgentId());
				User user_fqr = userService.selectById(payDeposit.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(user.getId()))){
					userList.add(user);
				}
				if(userList.size() > 0){
					assemblePayDepositNotice(payDeposit, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				// 营销负责人【销管经理】
				List<User> userList_xgjl = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_xgjl.add(saleLeaderUser);
				if(userList_xgjl.size() > 0 && "3".equals(payDeposit.getAuditStatus())){
					assemblePayDepositNotice(payDeposit, userList_xgjl, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("2".equals(noticeEntity.getNoticeType())) {// 退认筹审核结果
				// 实体对象
				PayDeposit payDeposit = payDepositService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(payDeposit.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人，及经纪人
				List<User> userList = new ArrayList<User>();
				User user = userService.selectById(payDeposit.getAgentId());
				User user_fqr = userService.selectById(payDeposit.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(user.getId()))){
					userList.add(user);
				}
				if(userList.size() > 0){
					assembleReturnPayDepositNotice(payDeposit, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				// 营销负责人【销管经理】
				List<User> userList_bbxx = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_bbxx.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_bbxx.add(financeLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(payDeposit.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_bbxx.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleReturnPayDepositNotice(payDeposit, userList_bbxx, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("3".equals(noticeEntity.getNoticeType())) {// 认购审核结果
				// 实体对象
				Subscribe subscribe = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe.getId());
				transactionRelationDto.setMerchantId(subscribe.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSubscribeNotice(subscribe, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_bbxx = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_bbxx.add(saleLeaderUser);
				if(userList_bbxx.size() > 0 && "3".equals(subscribe.getAuditStatus())){
					assembleSubscribeNotice(subscribe, userList_bbxx, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("4".equals(noticeEntity.getNoticeType())) {// 退认购审核结果
				// 实体对象
				Subscribe subscribe = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe.getId());
				transactionRelationDto.setMerchantId(subscribe.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleReturnSubscribeNotice(subscribe, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_trg = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_trg.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_trg.add(financeLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(subscribe.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_trg.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleReturnSubscribeNotice(subscribe, userList_trg, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("5".equals(noticeEntity.getNoticeType())) {// 认购折扣审核结果
				// 实体对象
				Subscribe subscribe = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe.getId());
				transactionRelationDto.setMerchantId(subscribe.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
			
				if(userList.size() > 0){
					assembleSubscribeDiscountNotice(subscribe, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				// 营销负责人【销管经理】
				List<User> userList_zksp = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_zksp.add(saleLeaderUser);
				if(userList_zksp.size() > 0 && "3".equals(subscribe.getAuditStatus())){
					assembleSubscribeDiscountNotice(subscribe, userList_zksp, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("6".equals(noticeEntity.getNoticeType())) {// 签约审核结果
				// 实体对象
				Signed signed = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed.getId());
				transactionRelationDto.setMerchantId(signed.getMerchantId());
				transactionRelationDto.setProjectCode(signed.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSignedNotice(signed, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_qy = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_qy.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_qy.add(financeLeaderUser);
				if(userList_qy.size() > 0 && "3".equals(signed.getAuditStatus())){
					assembleSignedNotice(signed, userList_qy, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("7".equals(noticeEntity.getNoticeType())) {// 签约折扣审核结果
				// 实体对象
				Signed signed = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed.getId());
				transactionRelationDto.setMerchantId(signed.getMerchantId());
				transactionRelationDto.setProjectCode(signed.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSignedDiscountNotice(signed, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_qyzk = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_qyzk.add(saleLeaderUser);
				if(userList_qyzk.size() > 0 && "3".equals(signed.getAuditStatus())){
					assembleSignedDiscountNotice(signed, userList_qyzk, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("8".equals(noticeEntity.getNoticeType())) {// 签约换房审核结果
				// 实体对象
				Signed signed = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed.getId());
				transactionRelationDto.setMerchantId(signed.getMerchantId());
				transactionRelationDto.setProjectCode(signed.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSignedWardsNotice(signed, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_qyhf = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_qyhf.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_qyhf.add(financeLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(signed.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_qyhf.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleSignedWardsNotice(signed, userList_qyhf, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("9".equals(noticeEntity.getNoticeType())) {// 认购换房审核结果
				// 实体对象
				Subscribe subscribe = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe.getId());
				transactionRelationDto.setMerchantId(subscribe.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSubscribeWardsNotice(subscribe, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_rghf = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_rghf.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_rghf.add(financeLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(subscribe.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_rghf.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleSubscribeWardsNotice(subscribe, userList_rghf, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			} else if ("10".equals(noticeEntity.getNoticeType())) {// 面积补差流程审核结果
				// 实体对象
				Signed signed_mjbc = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 经纪人
				/*TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed_mjbc.getId());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				List<User> userList = new ArrayList<User>();
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						userList.add(user);
					}
				}*/
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed_mjbc.getCreateUserId());
				userList.add(user_fqr);
				// 房源
				String proName = "";
				if (signed_mjbc.getRoomId() != null && !"".equals(signed_mjbc.getRoomId())) {
					ProjectRoom project = projectRoomService.selectById(signed_mjbc.getRoomId());
					if (project != null) {
						proName = project.getCombinedName();
					}
				}
				//逆向流程，从业务异常表获取审核状态
				ReserveAreaDto reserveAreaDto = new ReserveAreaDto();
				reserveAreaDto.setSignedId(signed_mjbc.getId());
				ReserveArea reserveArea = reserveAreaService.selectByDto(reserveAreaDto);
				// 项目
				/*ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed_mjbc.getProjectCode());
				Project project = projectService.selectByDto(proDto);*/

				// 面积补差流程, 获取字典表dictionary_value = 'NT37' 的消息模板
				// 消息模板: 面积补差流程：【${auditStatus}】房号：${roomName}
				String msgTemp = "面积补差流程审核结果【${auditStatus}】房号：${roomName}";
				String sendMsg = "";
				DictionaryDto dicDto = new DictionaryDto();
				dicDto.setDictionaryValue("NT37");
				Dictionary dic = dictionaryService.selectByDto(dicDto);
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}",
						AuditStatusEnum.getByNo(reserveArea.getAuditStatus()).getDes()).replace("${roomName}", proName);
				// 创建提醒消息及消息发送人信息
				Map<String, String> noticeParamMap = new HashMap<String, String>();
				noticeParamMap.put("noticeDicId", "196");
				noticeParamMap.put("noticeTempType", "NT37");
				noticeParamMap.put("sendMsg", sendMsg);
				noticeParamMap.put("title", "面积补差流程审核结果");
				noticeParamMap.put("merchantId", String.valueOf(signed_mjbc.getMerchantId()));
				noticeParamMap.put("userCode", signed_mjbc.getUserCode());
				noticeParamMap.put("accessCode", signed_mjbc.getAccessCode());
				noticeParamMap.put("createUserId", String.valueOf(signed_mjbc.getCreateUserId()));
				/*
				 * (ym) 提醒内容增加超链接 start
				 * */
				Map<String,String> replaceValuesMap=new HashMap<String,String>();
				replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed_mjbc.getRoomId()));
				replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
				replaceValuesMap.put(MsgUtil.CUSTOMER_ID, "");
				replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,"");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
				replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed_mjbc.getId()+"");
				replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
				replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, signed_mjbc.getProcInstId()+"");
		    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
		    	/*
				 * (ym) 提醒内容增加超链接 end
				 * */
		    	createNotice(noticeParamMap, userList);
				// 消息推送
				//pushMsg(noticeId, signed_mjbc.getProjectCode(), project.getProjectName(), "NT37", "面积补差流程审核结果");

			} else if ("11".equals(noticeEntity.getNoticeType())) {// 退房流程审核结果
				// 实体对象
				Signed signed_tf = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed_tf.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed_tf.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed_tf.getId());
				transactionRelationDto.setMerchantId(signed_tf.getMerchantId());
				transactionRelationDto.setProjectCode(signed_tf.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSignOutNotice(signed_tf, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_qytf = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_qytf.add(saleLeaderUser);
				// 财务负责人
				User financeLeaderUser = userService.selectById(pObj.get(0).getFinanceLeader());
				userList_qytf.add(financeLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(signed_tf.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_qytf.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleSignOutNotice(signed_tf, userList_qytf, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
				
			} else if ("12".equals(noticeEntity.getNoticeType())) {// 延期签约审核结果
				// 实体对象
				Subscribe subscribe_yqqy = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe_yqqy.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe_yqqy.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe_yqqy.getId());
				transactionRelationDto.setMerchantId(subscribe_yqqy.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe_yqqy.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleDelaySignedNotice(subscribe_yqqy, userList, "1", null, noticeEntity.getTimeType(), noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_yqqy = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_yqqy.add(saleLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(subscribe_yqqy.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_yqqy.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleDelaySignedNotice(subscribe_yqqy, userList_yqqy, "2", userName_fqr, noticeEntity.getTimeType(), noticeEntity.getProcessInstanceId());
				}
				
			} else if ("13".equals(noticeEntity.getNoticeType())) {// 更名流程审核结果（签约）
				// 实体对象
				Signed signed_tf = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed_tf.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed_tf.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed_tf.getId());
				transactionRelationDto.setMerchantId(signed_tf.getMerchantId());
				transactionRelationDto.setProjectCode(signed_tf.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSignedRenameNotice(signed_tf, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_gmsp = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_gmsp.add(saleLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(signed_tf.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_gmsp.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleSignedRenameNotice(signed_tf, userList_gmsp, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}

			} else if ("14".equals(noticeEntity.getNoticeType())) {// 价格方案流程审核结果
				// 实体对象
				PriceScheme priceScheme = priceSchemeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				Project project = projectService.selectById(priceScheme.getProjectId());
				// 发起人
				UserDto entity = new UserDto();
				entity.setUserCode(priceScheme.getUserCode());
				User user = userService.selectByDto(entity);
				String userName_fqr = user.getUserName();
				List<User> userList = new ArrayList<User>();
				userList.add(user);
				if(userList.size() > 0){
					assemblePricePlanNotice(priceScheme, project, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_jgfa = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_jgfa.add(saleLeaderUser);
				if(userList_jgfa.size() > 0 && "01".equals(priceScheme.getStatus())){
					assemblePricePlanNotice(priceScheme, project, userList_jgfa, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
				
			}else if ("15".equals(noticeEntity.getNoticeType())) {// 价格方案失效流程审核结果
				// 实体对象
				PriceScheme priceScheme = priceSchemeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				Project project = projectService.selectById(priceScheme.getProjectId());
				// 发起人
				UserDto entity = new UserDto();
				entity.setUserCode(priceScheme.getUserCode());
				User user = userService.selectByDto(entity);
				String userName_fqr = user.getUserName();
				List<User> userList = new ArrayList<User>();
				userList.add(user);
				if(userList.size() > 0){
					assemblePricePlanInvalidNotice(priceScheme, project, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_jgfa = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_jgfa.add(saleLeaderUser);
				if(userList_jgfa.size() > 0 && "01".equals(priceScheme.getStatus())){
					assemblePricePlanInvalidNotice(priceScheme,  project, userList_jgfa, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}
			}else if ("16".equals(noticeEntity.getNoticeType())) {// 应收款延期流程审核结果
				// 实体对象
				Signed signed_yskyq = signedService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(signed_yskyq.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(signed_yskyq.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(signed_yskyq.getId());
				transactionRelationDto.setMerchantId(signed_yskyq.getMerchantId());
				transactionRelationDto.setProjectCode(signed_yskyq.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assemblePaymentDelayNotice(signed_yskyq, userList, "1", null,noticeEntity.getTimeType(), noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_gmsp = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_gmsp.add(saleLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(signed_yskyq.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_gmsp.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assemblePaymentDelayNotice(signed_yskyq, userList_gmsp, "2", userName_fqr, noticeEntity.getTimeType(), noticeEntity.getProcessInstanceId());
				}
			} else if ("17".equals(noticeEntity.getNoticeType())) {// 更名流程审核结果（认购）
				// 实体对象
				Subscribe subscribe_gm = subscribeService.selectById(noticeEntity.getNoticeBusinessId());
				// 项目
				ProjectDto proDto = new ProjectDto();
				proDto.setProjectCode(subscribe_gm.getProjectCode());
				Project project = projectService.selectByDto(proDto);
				// 发起人
				List<User> userList = new ArrayList<User>();
				User user_fqr = userService.selectById(subscribe_gm.getCreateUserId());
				String userName_fqr = user_fqr.getUserName();
				userList.add(user_fqr);
				// 经纪人
				TransactionRelationDto transactionRelationDto = new TransactionRelationDto();
				transactionRelationDto.setBusinessId(subscribe_gm.getId());
				transactionRelationDto.setMerchantId(subscribe_gm.getMerchantId());
				transactionRelationDto.setProjectCode(subscribe_gm.getProjectCode());
				List<TransactionRelation> transactionRelationList = transactionRelationService.selectListByDto(transactionRelationDto);
				if (transactionRelationList.size() > 0) {
					for (int i = 0; i < transactionRelationList.size(); i++) {
						User user = userService.selectById(transactionRelationList.get(i).getRelationAgentid());
						if(!String.valueOf(user_fqr.getId()).equals(String.valueOf(transactionRelationList.get(i).getRelationAgentid()))){
							userList.add(user);
						}
					}
				}
				
				if(userList.size() > 0){
					assembleSubscribeRenameNotice(subscribe_gm, userList, "1", null, noticeEntity.getProcessInstanceId());
				}
				
				// 营销负责人【销管经理】
				List<User> userList_gmsp = new ArrayList<User>();
				ProjectSettingDto pDto = new ProjectSettingDto();
				pDto.setProjectCode(project.getProjectCode());
				List<ProjectSetting> pObj = projectSettingService.selectListByDto(pDto);
				User saleLeaderUser = userService.selectById(pObj.get(0).getMaLeader());
				userList_gmsp.add(saleLeaderUser);
				//逆向流程，从业务异常表获取审核状态
				BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
				businessAbnormaDto.setBusinessId(subscribe_gm.getId());
				BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
				if(userList_gmsp.size() > 0 && "3".equals(businessAbnorma.getAuditStatus())){
					assembleSubscribeRenameNotice(subscribe_gm, userList_gmsp, "2", userName_fqr, noticeEntity.getProcessInstanceId());
				}

			} 
			return true;
		}catch(Exception e){
			e.printStackTrace();
			response.setSuccess(false);
			logger.error("组装app消息内容异常:{}",e);
		}
		return true;
	}

	/**
	 * 插入消息
	 * @param noticeParamMap 消息map,userList 接收人list
	 * @return
	 */
	public long createNotice(Map<String, String> noticeParamMap,List<User> userList) {
		NoticeDto noticeDto1 = new NoticeDto();
		try{
			//生成消息,生成接收人信息
			NoticeDto noticeDto = new NoticeDto();
			//通知字典表中类型ID
			noticeDto.setDictionaryId(Long.parseLong(noticeParamMap.get("noticeDicId")));
			noticeDto.setNoticeType(NoticeTypeEnum.REMIND.getNo());
			noticeDto.setNoticeTempType(noticeParamMap.get("noticeTempType")); 
			noticeDto.setTitle(noticeParamMap.get("title"));
			noticeDto.setContent(noticeParamMap.get("sendMsg"));
			noticeDto.setIssueTime(Calendar.getInstance().getTime());
			if(noticeParamMap.get("timerNotice") != null){
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				noticeDto.setTimerNotice(sdf.parse(noticeParamMap.get("timerNotice")));
			}
			noticeDto.setMerchantId(Long.parseLong(noticeParamMap.get("merchantId")));
			if(noticeParamMap.get("projectCode") != null){
				noticeDto.setProjectCode(noticeParamMap.get("projectCode"));
			}
			noticeDto.setUserCode(noticeParamMap.get("userCode"));
			noticeDto.setAccessCode(noticeParamMap.get("accessCode"));
			noticeDto.setIsValid(IsValidEnum.VALID.getNo());
			noticeDto.setIsRead(IsReadEnum.UNREAD.getNo());
			noticeDto.setIsSend(IsSendEnum.UNSEND.getNo());
			noticeDto.setCreateUserId(Long.parseLong(noticeParamMap.get("createUserId")));
			noticeDto.setDelFlag(DelFlagEnum.UNDEL.getNo());
		    /*
             * (ym) 提醒内容增加超链接 start
             * */
            noticeDto.setRemark(noticeParamMap.get("replaceValues"));
            /*
             * (ym) 提醒内容增加超链接 end
             * */
			noticeDto1 = noticeService.create(noticeDto);
			
			//添加接收人
			if(userList != null){
				for(User user: userList){
					MessageReceiverDto msgRecDto = new MessageReceiverDto();
					msgRecDto.setNoticeId(noticeDto1.getId());
					msgRecDto.setReceiverId(user.getId());
					msgRecDto.setReceiveStatus(ReceiveStatusEnum.UNRECEIVED.getNo());
					msgRecDto.setMerchantId(Long.parseLong(noticeParamMap.get("merchantId")));
					msgRecDto.setCreateUserId(Long.parseLong(noticeParamMap.get("createUserId")));
					msgRecDto.setUpdateTime(new Date());
					msgRecDto.setDelFlag(DelFlagEnum.UNDEL.getNo());
					messageReceiverService.create(msgRecDto);
					
					/**
					 * sys_tm_notice_temporary 保存推送消息内容入库
					 * date：2017-03-02
					 */
					NoticeTemporaryDto noticeTemporaryDto = new NoticeTemporaryDto();
					noticeTemporaryDto.setMerchantId(Long.parseLong(noticeParamMap.get("merchantId")));
					noticeTemporaryDto.setProjectCode(noticeParamMap.get("projectCode"));
					ProjectDto entity = new ProjectDto();
					entity.setProjectCode(noticeParamMap.get("projectCode"));
					Project project = projectService.selectByDto(entity);
					noticeTemporaryDto.setProjectName(project.getProjectName());
					noticeTemporaryDto.setReceiverId(user.getId());
					noticeTemporaryDto.setAction(noticeParamMap.get("title"));
					noticeTemporaryDto.setBusinessId(noticeParamMap.get("businessId"));
					noticeTemporaryDto.setPushType(noticeParamMap.get("noticeTempType"));
					if(StringUtils.isNotEmpty(noticeParamMap.get("customerId"))){
						noticeTemporaryDto.setCustomerId(noticeParamMap.get("customerId"));
					}
					noticeTemporaryDto.setTitle(noticeDto.getTitle());
					noticeTemporaryDto.setContent(noticeDto.getContent());
					if(StringUtils.isNotEmpty(noticeParamMap.get("tempType"))){
						noticeTemporaryDto.setTempType(noticeParamMap.get("tempType"));
					}
					noticeTemporaryDto.setDelFlag(DelFlagEnum.UNDEL.getNo());
					noticeTemporaryService.create(noticeTemporaryDto);
				}
			}
			return noticeDto1.getId();
		}catch(Exception e){
			e.printStackTrace();
			response.setSuccess(false);
			logger.error("插入app消息内容【认筹】异常:{}",e);
		}
		return noticeDto1.getId();
	} 

	public void pushMsg(Long noticeId, String projectCode,String projectName,String noticeTempType,String actionTitle) throws Exception{
		try {
	 		MessageReceiverDto mrDto = new MessageReceiverDto();
	 		mrDto.setNoticeId(noticeId);
	 		mrDto.setIsSend(IsSendEnum.UNSEND.getNo());
	   	 	List<MessageReceiverDto> mrList = messageReceiverService.selectPushMsgListByDto(mrDto);
	   	 	
	   	 	if(mrList != null && mrList.size() > 0){
	   	 		for(MessageReceiverDto msgRecDto: mrList){
	   	 			//开始推送消息
		   	 		Map<String, String> pushMap = new HashMap<String, String>();
			   	 	pushMap.put("action", actionTitle);
			   	 	pushMap.put("remindCategoryId", String.valueOf(msgRecDto.getDictionaryId()));
			   	 	pushMap.put("pushType", msgRecDto.getNoticeTempType());
			   	    pushMap.put("projectCode",projectCode);
			   	    pushMap.put("projectName", projectName);
					String context = msgRecDto.getContent();
					appPushService.pushMessage(String.valueOf(msgRecDto.getReceiverId()), context, msgRecDto.getTitle(), pushMap);
	   	 		}
	   	 		
	   	 	   //更新消息
	   	 	   NoticeDto updateNoticeDto = new NoticeDto();
	   	 	   updateNoticeDto.setId(noticeId);
	   	 	   updateNoticeDto.setIsSend(IsSendEnum.SEND.getNo());
	   	 	   noticeService.update(updateNoticeDto);
	   	 	}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 消息内容【认筹】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assemblePayDepositNotice(PayDeposit payDeposit, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (payDeposit.getRoomId() != null && !"".equals(payDeposit.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(payDeposit.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(payDeposit.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			// 判断是否无房认筹: 0: 有房认筹 1、无房认筹
			String msgTemp = "";
			if (IsPaydepositEnum.YES.getNo().equals(payDeposit.getIsPaydeposit())) {
				// 无房认筹, 获取字典表dictionary_value = 'NT24' 的消息模板
				// 消息模板: 无房认筹：【${auditStatus}】房号：${roomName}；客户：${customer};
				if("1".equals(type)){
					msgTemp= "认筹审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
				}else{
					//msgTemp= "【认筹】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
					msgTemp = ReportMessageEnum.RC.getDes();
				}
				String sendMsg = "";
				DictionaryDto dicDto = new DictionaryDto();
				dicDto.setDictionaryValue("NT24");
				Dictionary dic = dictionaryService.selectByDto(dicDto);
				String roomName = "无";
				if("1".equals(type)){
					if (dic != null) {
						msgTemp = dic.getDictionaryName();
					}
					sendMsg = msgTemp
							.replace("${auditStatus}", AuditStatusEnum.getByNo(payDeposit.getAuditStatus()).getDes())
							.replace("${roomName}", roomName).replace("${customer}", cusName);
				}else{
					sendMsg = msgTemp
							.replace("${roomName}", roomName)
							.replace("${customer}", cusName)
							.replace("${userName}", userName_fqr);
				}
				// 创建提醒消息及消息发送人信息
				noticeParamMap.put("noticeDicId", "183");
				noticeParamMap.put("noticeTempType", "NT24");
				noticeParamMap.put("sendMsg", sendMsg);
				noticeParamMap.put("title", "无房认筹流程审核结果");
				noticeParamMap.put("merchantId", String.valueOf(payDeposit.getMerchantId()));
				noticeParamMap.put("projectCode", String.valueOf(payDeposit.getProjectCode()));
				noticeParamMap.put("userCode", payDeposit.getUserCode());
				noticeParamMap.put("accessCode", payDeposit.getAccessCode());
				noticeParamMap.put("createUserId", String.valueOf(payDeposit.getCreateUserId()));
				noticeParamMap.put("customerId", String.valueOf(payDeposit.getCustomerId()));
				noticeParamMap.put("businessId", String.valueOf(payDeposit.getId()));
				if("1".equals(type)){
					noticeParamMap.put("tempType", "2");
				}else{
					noticeParamMap.put("tempType", "3");
				}
				/*
				 * (ym) 提醒内容增加超链接 start
				 * */
				Map<String,String> replaceValuesMap=new HashMap<String,String>();
				replaceValuesMap.put(MsgUtil.ROOM_ID, "");
				replaceValuesMap.put(MsgUtil.ROOM_NAME, "");
				replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
				replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
				replaceValuesMap.put(MsgUtil.BUSINESS_ID, payDeposit.getId()+"");
				replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
				replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
		    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
		    	/*
				 * (ym) 提醒内容增加超链接 end
				 * */
				createNotice(noticeParamMap, userList);
				// 消息推送
				//pushMsg(noticeId, payDeposit.getProjectCode(), project.getProjectName(), "NT24", "无房认筹流程审核结果");
			} else {
				// 有房认筹, 获取字典表dictionary_value = 'NT25' 的消息模板
				// 消息模板: 有房认筹: 【${auditStatus}】房号：${roomName}；客户：${customer};
				if("1".equals(type)){
					msgTemp= "认筹审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
				}else{
					//msgTemp= "【认筹】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
					msgTemp = ReportMessageEnum.RC.getDes();
				}
				String sendMsg = "";
				DictionaryDto dicDto = new DictionaryDto();
				dicDto.setDictionaryValue("NT25");
				Dictionary dic = dictionaryService.selectByDto(dicDto);
				if("1".equals(type)){
					if (dic != null) {
						msgTemp = dic.getDictionaryName();
					}
					sendMsg = msgTemp
						.replace("${auditStatus}", AuditStatusEnum.getByNo(payDeposit.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
				}else{
					sendMsg = msgTemp
							.replace("${roomName}", proName)
							.replace("${customer}", cusName)
							.replace("${userName}", userName_fqr);
				}
				// 创建提醒消息及消息发送人信息
				noticeParamMap.put("noticeDicId", "184");
				noticeParamMap.put("noticeTempType", "NT25");
				noticeParamMap.put("sendMsg", sendMsg);
				noticeParamMap.put("title", "有房认筹流程审核结果");
				noticeParamMap.put("merchantId", String.valueOf(payDeposit.getMerchantId()));
				noticeParamMap.put("projectCode", String.valueOf(payDeposit.getProjectCode()));
				noticeParamMap.put("userCode", payDeposit.getUserCode());
				noticeParamMap.put("accessCode", payDeposit.getAccessCode());
				noticeParamMap.put("createUserId", String.valueOf(payDeposit.getCreateUserId()));
				noticeParamMap.put("customerId", String.valueOf(payDeposit.getCustomerId()));
				noticeParamMap.put("businessId", String.valueOf(payDeposit.getId()));
				if("1".equals(type)){
					noticeParamMap.put("tempType", "2");
				}else{
					noticeParamMap.put("tempType", "3");
				}
				/*
				 * (ym) 提醒内容增加超链接 start
				 * */
				Map<String,String> replaceValuesMap=new HashMap<String,String>();
				replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(payDeposit.getRoomId()));
				replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
				replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
				replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
				replaceValuesMap.put(MsgUtil.BUSINESS_ID, payDeposit.getId()+"");
				replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
				replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
		    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
		    	/*
				 * (ym) 提醒内容增加超链接 end
				 * */
		    	createNotice(noticeParamMap, userList);
				// 消息推送
				//pushMsg(noticeId, payDeposit.getProjectCode(), project.getProjectName(), "NT25", "有房认筹流程审核结果");
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【认筹】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【退认筹】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleReturnPayDepositNotice(PayDeposit payDeposit, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (payDeposit.getRoomId() != null && !"".equals(payDeposit.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(payDeposit.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(payDeposit.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(payDeposit.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 判断是否无房认筹: 0: 有房认筹 1、无房认筹
			if (IsPaydepositEnum.YES.getNo().equals(payDeposit.getIsPaydeposit())) {
				// 无房认筹, 获取字典表dictionary_value = 'NT32' 的消息模板
				// 消息模板: 无房认筹：【${auditStatus}】房号：${roomName}；客户：${customer};
				String msgTemp = "";
				if("1".equals(type)){
					msgTemp = "退认筹审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
				}else{
					//msgTemp= "【退认筹】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
					msgTemp = ReportMessageEnum.TRC.getDes();
				}
				String sendMsg = "";
				DictionaryDto dicDto = new DictionaryDto();
				dicDto.setDictionaryValue("NT32");
				Dictionary dic = dictionaryService.selectByDto(dicDto);
				String roomName = "无";
				if("1".equals(type)){
					if (dic != null) {
						msgTemp = dic.getDictionaryName();
					}
					sendMsg = msgTemp
							.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
							.replace("${roomName}", roomName).replace("${customer}", cusName);
				}else{
					sendMsg = msgTemp
							.replace("${roomName}", proName)
							.replace("${customer}", cusName)
							.replace("${userName}", userName_fqr);
				}
				// 创建提醒消息及消息发送人信息
				noticeParamMap.put("noticeDicId", "191");
				noticeParamMap.put("noticeTempType", "NT32");
				noticeParamMap.put("sendMsg", sendMsg);
				noticeParamMap.put("title", "无房退认筹流程审核结果");
				noticeParamMap.put("merchantId", String.valueOf(payDeposit.getMerchantId()));
				noticeParamMap.put("projectCode", String.valueOf(payDeposit.getProjectCode()));
				noticeParamMap.put("userCode", payDeposit.getUserCode());
				noticeParamMap.put("accessCode", payDeposit.getAccessCode());
				noticeParamMap.put("createUserId", String.valueOf(payDeposit.getCreateUserId()));
				noticeParamMap.put("customerId", String.valueOf(payDeposit.getCustomerId()));
				noticeParamMap.put("businessId", String.valueOf(payDeposit.getId()));
				if("1".equals(type)){
					noticeParamMap.put("tempType", "2");
				}else{
					noticeParamMap.put("tempType", "3");
				}
				/*
				 * (ym) 提醒内容增加超链接 start
				 * */
				Map<String,String> replaceValuesMap=new HashMap<String,String>();
				replaceValuesMap.put(MsgUtil.ROOM_ID, "");
				replaceValuesMap.put(MsgUtil.ROOM_NAME, "");
				replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
				replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
				replaceValuesMap.put(MsgUtil.BUSINESS_ID, payDeposit.getId()+"");
				replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
				replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
		    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
		    	/*
				 * (ym) 提醒内容增加超链接 end
				 * */
		    	createNotice(noticeParamMap, userList);
				// 消息推送
				//pushMsg(noticeId, payDeposit.getProjectCode(), project.getProjectName(), "NT32", "无房退认筹流程审核结果");
			} else {
				// 有房认筹, 获取字典表dictionary_value = 'NT32' 的消息模板
				// 消息模板: 有房认筹: 【${auditStatus}】房号：${roomName}；客户：${customer};
				String msgTemp = "";
				if("1".equals(type)){
					msgTemp = "退认筹审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
				}else{
					//msgTemp= "【退认筹】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
					msgTemp = ReportMessageEnum.TRC.getDes();
				}
				String sendMsg = "";
				DictionaryDto dicDto = new DictionaryDto();
				dicDto.setDictionaryValue("NT32");
				Dictionary dic = dictionaryService.selectByDto(dicDto);
				if("1".equals(type)){
					if (dic != null) {
						msgTemp = dic.getDictionaryName();
					}
					sendMsg = msgTemp
						.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
				}else{
					sendMsg = msgTemp
							.replace("${roomName}", proName)
							.replace("${customer}", cusName)
							.replace("${userName}", userName_fqr);
				}
				// 创建提醒消息及消息发送人信息
				noticeParamMap.put("noticeDicId", "191");
				noticeParamMap.put("noticeTempType", "NT32");
				noticeParamMap.put("sendMsg", sendMsg);
				noticeParamMap.put("title", "有房退认筹流程审核结果");
				noticeParamMap.put("merchantId", String.valueOf(payDeposit.getMerchantId()));
				noticeParamMap.put("projectCode", String.valueOf(payDeposit.getProjectCode()));
				noticeParamMap.put("userCode", payDeposit.getUserCode());
				noticeParamMap.put("accessCode", payDeposit.getAccessCode());
				noticeParamMap.put("createUserId", String.valueOf(payDeposit.getCreateUserId()));
				noticeParamMap.put("customerId", String.valueOf(payDeposit.getCustomerId()));
				noticeParamMap.put("businessId", String.valueOf(payDeposit.getId()));
				if("1".equals(type)){
					noticeParamMap.put("tempType", "2");
				}else{
					noticeParamMap.put("tempType", "3");
				}
				/*
				 * (ym) 提醒内容增加超链接 start
				 * */
				Map<String,String> replaceValuesMap=new HashMap<String,String>();
				replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(payDeposit.getRoomId()));
				replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
				replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
				replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
				replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
				replaceValuesMap.put(MsgUtil.BUSINESS_ID, payDeposit.getId()+"");
				replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
				replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
		    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
		    	/*
				 * (ym) 提醒内容增加超链接 end
				 * */
		    	createNotice(noticeParamMap, userList);
				// 消息推送
				//pushMsg(noticeId, payDeposit.getProjectCode(), project.getProjectName(), "NT32", "有房退认筹流程审核结果");
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【退认筹】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【认购】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSubscribeNotice(Subscribe subscribe, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe.getRoomId() != null && !"".equals(subscribe.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			// 认购, 获取字典表dictionary_value = 'NT26' 的消息模板
			// 消息模板: 认购：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "认购审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp= "【认购】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.RG.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT26");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
						.replace("${auditStatus}", AuditStatusEnum.getByNo(subscribe.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "185");
			noticeParamMap.put("noticeTempType", "NT26");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "认购流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(subscribe.getProjectCode()));
			noticeParamMap.put("userCode", subscribe.getUserCode());
			noticeParamMap.put("accessCode", subscribe.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe.getProjectCode(), project.getProjectName(), "NT26", "认购流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【认购】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【退认购】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleReturnSubscribeNotice(Subscribe subscribe, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe.getRoomId() != null && !"".equals(subscribe.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(subscribe.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 退认购, 获取字典表dictionary_value = 'NT31' 的消息模板
			// 消息模板: 退认购：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "退认购审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp= "【退认购】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.TRG.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT31");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
					.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "190");
			noticeParamMap.put("noticeTempType", "NT31");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "退认购流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(subscribe.getProjectCode()));
			noticeParamMap.put("userCode", subscribe.getUserCode());
			noticeParamMap.put("accessCode", subscribe.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe.getProjectCode(), project.getProjectName(), "NT31", "退认购流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【退认购】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【认购折扣审批】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSubscribeDiscountNotice(Subscribe subscribe, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe.getRoomId() != null && !"".equals(subscribe.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			// 认购折扣, 获取字典表dictionary_value = 'NT28' 的消息模板
			// 消息模板: 认购折扣：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "认购折扣审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp= "【认购折扣审批（破底价）】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.RGZKSP.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT28");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			// 获取折扣审批状态
			BusinessAbnormaDto businessAbnormaDto = new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(subscribe.getId());// 业务ID
			List<BusinessAbnorma> businessAbnormaList = businessAbnormaService.selectListByDto(businessAbnormaDto);
			String auditStatus = "";
			if (businessAbnormaList.size() > 0) {
				for (BusinessAbnorma businessAbnorma : businessAbnormaList) {
					auditStatus = AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes();
				}
			}
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", auditStatus).replace("${roomName}", proName)
						.replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "187");
			noticeParamMap.put("noticeTempType", "NT28");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "认购折扣流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(subscribe.getProjectCode()));
			noticeParamMap.put("userCode", subscribe.getUserCode());
			noticeParamMap.put("accessCode", subscribe.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
			noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
			/*
			 * (ym) 提醒内容增加超链接 end
			 * */
			createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe.getProjectCode(), project.getProjectName(), "NT28", "认购折扣流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【认购折扣审批】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【签约】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSignedNotice(Signed signed, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed.getRoomId() != null && !"".equals(signed.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			// 签约, 获取字典表dictionary_value = 'NT27' 的消息模板
			// 消息模板: 签约：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "签约审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp= "【签约】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.QY.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT27");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", AuditStatusEnum.getByNo(signed.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "186");
			noticeParamMap.put("noticeTempType", "NT27");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "签约流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(signed.getProjectCode()));
			noticeParamMap.put("userCode", signed.getUserCode());
			noticeParamMap.put("accessCode", signed.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed.getProjectCode(), project.getProjectName(), "NT27", "签约流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【签约】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【签约折扣审批】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSignedDiscountNotice(Signed signed, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed.getRoomId() != null && !"".equals(signed.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			// 签约折扣, 获取字典表dictionary_value = 'NT28' 的消息模板
			// 消息模板: 签约折扣：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "签约折扣审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp= "【签约折扣审批（破底价）】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.QYZKSP.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT281");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			// 获取折扣审批状态
			BusinessAbnormaDto businessAbnormaDto = new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(signed.getId());// 业务ID
			List<BusinessAbnorma> businessAbnormaList = businessAbnormaService.selectListByDto(businessAbnormaDto);
			String auditStatus = "";
			if (businessAbnormaList.size() > 0) {
				for (BusinessAbnorma businessAbnorma : businessAbnormaList) {
					auditStatus = AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes();
				}
			}
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", auditStatus).replace("${roomName}", proName)
						.replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "229");
			noticeParamMap.put("noticeTempType", "NT281");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "签约折扣流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(signed.getProjectCode()));
			noticeParamMap.put("userCode", signed.getUserCode());
			noticeParamMap.put("accessCode", signed.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed.getProjectCode(), project.getProjectName(), "NT28", "签约折扣流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【签约折扣审批】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【签约换房】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSignedWardsNotice(Signed signed, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed.getRoomId() != null && !"".equals(signed.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(signed.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 签约换房, 获取字典表dictionary_value = 'NT29' 的消息模板
			// 消息模板: 签约换房：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "签约换房审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp = "【签约换房】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.QYHF.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT29");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "188");
			noticeParamMap.put("noticeTempType", "NT29");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "签约换房流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(signed.getProjectCode()));
			noticeParamMap.put("userCode", signed.getUserCode());
			noticeParamMap.put("accessCode", signed.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed.getProjectCode(), project.getProjectName(), "NT29", "签约换房流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【签约换房】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【认购换房】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSubscribeWardsNotice(Subscribe subscribe, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe.getRoomId() != null && !"".equals(subscribe.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(subscribe.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 认购换房, 获取字典表dictionary_value = 'NT29' 的消息模板
			// 消息模板: 认购换房：【${auditStatus}】房号：${roomName}；客户：${customer};
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "认购换房审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp = "【认购换房】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.RGHF.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT29");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
					.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
					.replace("${roomName}", proName)
					.replace("${customer}", cusName)
					.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "188");
			noticeParamMap.put("noticeTempType", "NT29");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "认购换房流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe.getMerchantId()));
			noticeParamMap.put("projectCode", String.valueOf(subscribe.getProjectCode()));
			noticeParamMap.put("userCode", subscribe.getUserCode());
			noticeParamMap.put("accessCode", subscribe.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe.getProjectCode(), project.getProjectName(), "NT29", "认购换房流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【认购换房】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【签约退房】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSignOutNotice(Signed signed_tf, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed_tf.getRoomId() != null && !"".equals(signed_tf.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed_tf.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed_tf.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(signed_tf.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 退房流程, 获取字典表dictionary_value = 'NT30' 的消息模板
			// 消息模板: 退房审核结果【${auditStatus}】房号：${roomName}；客户：${customer}
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "退房审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				//msgTemp = "【签约退房】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.QYTF.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT30");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
					.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
					.replace("${roomName}", proName)
					.replace("${customer}", cusName)
					.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "189");
			noticeParamMap.put("noticeTempType", "NT30");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "退房流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed_tf.getMerchantId()));
			noticeParamMap.put("userCode", signed_tf.getUserCode());
			noticeParamMap.put("accessCode", signed_tf.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed_tf.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed_tf.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed_tf.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed_tf.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed_tf.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed_tf.getProjectCode(), project.getProjectName(), "NT30", "退房流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【签约退房】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【延期签约】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param timeType 延期时间类型
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleDelaySignedNotice(Subscribe subscribe_yqqy, List<User> userList, String type, String userName_fqr, String timeType, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe_yqqy.getRoomId() != null && !"".equals(subscribe_yqqy.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe_yqqy.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe_yqqy.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(subscribe_yqqy.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 延期签约流程, 获取字典表dictionary_value = 'NT34' 的消息模板
			// 消息模板: 延期签约审核结果【${auditStatus}】房号：${roomName}；客户：${customer}
			String msgTemp = "";
			String yqqy = "";
			if("1".equals(timeType)){
				yqqy = "(15天内)";
			}else if("2".equals(timeType)){
				yqqy = "(15~30天)";
			}else if("3".equals(timeType)){
				yqqy = "(30天以上)";
			}
			if("1".equals(type)){
				msgTemp = "延期签约"+yqqy+"审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				msgTemp = "【延期签约"+yqqy+"】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT34");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
						.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "193");
			noticeParamMap.put("noticeTempType", "NT34");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "延期签约流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe_yqqy.getMerchantId()));
			noticeParamMap.put("userCode", subscribe_yqqy.getUserCode());
			noticeParamMap.put("accessCode", subscribe_yqqy.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe_yqqy.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe_yqqy.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe_yqqy.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe_yqqy.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe_yqqy.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe_yqqy.getProjectCode(), project.getProjectName(), "NT34", "延期签约流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【延期签约】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【签约更名审核】组装
	 * 
	 * @param signed 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSignedRenameNotice(Signed signed_tf, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed_tf.getRoomId() != null && !"".equals(signed_tf.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed_tf.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed_tf.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(signed_tf.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 更名流程, 获取字典表dictionary_value = 'NT33' 的消息模板
			// 消息模板: 更名审核结果【${auditStatus}】房号：${roomName}；客户：${customer}
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "签约更名审核结果【${auditStatus}】房号：${roomName}；客户：${customer}";
			}else{
				//msgTemp = "【签约更名】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.QYGM.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT33");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
					.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "192");
			noticeParamMap.put("noticeTempType", "NT33");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "签约更名流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed_tf.getMerchantId()));
			noticeParamMap.put("userCode", signed_tf.getUserCode());
			noticeParamMap.put("accessCode", signed_tf.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed_tf.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed_tf.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed_tf.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed_tf.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed_tf.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed_tf.getProjectCode(), project.getProjectName(), "NT33", "更名流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【签约更名审核】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}

	/**
	 * 消息内容【价格方案】组装
	 * 
	 * @param signed 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assemblePricePlanNotice(PriceScheme priceScheme, Project project, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 价格方案流程, 获取字典表dictionary_value = 'NT36' 的消息模板
			// 消息模板: 价格方案审核结果【${auditStatus}】方案名称：${schemeName}
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "价格方案审核结果【${auditStatus}】方案名称：${schemeName}";
			}else{
				//msgTemp = "【价格方案】：${schemeName}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.JGFA.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT36");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			String status = null;
			if ("10".equals(priceScheme.getStatus())) {
				status = "已通过";
			} else if ("20".equals(priceScheme.getStatus())) {
				status = "已退回";
			}
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", status).replace("${schemeName}", priceScheme.getName());
			}else{
				sendMsg = msgTemp.replace("${schemeName}", priceScheme.getName()).replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "195");
			noticeParamMap.put("noticeTempType", "NT36");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "价格方案流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(priceScheme.getMerchantId()));
			noticeParamMap.put("userCode", priceScheme.getUserCode());
			noticeParamMap.put("accessCode", priceScheme.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(priceScheme.getCreateUserId()));
			noticeParamMap.put("businessId", String.valueOf(priceScheme.getId()));
			noticeParamMap.put("projectCode", project.getProjectCode());
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, "");
			replaceValuesMap.put(MsgUtil.ROOM_NAME, "");
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, "");
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,"");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, String.valueOf(priceScheme.getId()));
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, priceScheme.getName());
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, priceScheme.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, priceScheme.getProjectCode(), project.getProjectName(), "NT36", "价格方案流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【价格方案】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【价格方案失效】组装
	 * 
	 * @param signed 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assemblePricePlanInvalidNotice(PriceScheme priceScheme, Project project, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 价格方案流程, 获取字典表dictionary_value = 'NT36' 的消息模板
			// 消息模板: 价格方案审核结果【${auditStatus}】方案名称：${schemeName}
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "价格方案失效审核结果【${auditStatus}】方案名称：${schemeName}";
			}else{
				//msgTemp = "【价格方案失效】：${schemeName}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.JGFASX.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT36");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			String status = null;
			if ("10".equals(priceScheme.getStatus())) {
				status = "已通过";
			} else if ("20".equals(priceScheme.getStatus())) {
				status = "已退回";
			}
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp.replace("${auditStatus}", status).replace("${schemeName}", priceScheme.getName());
			}else{
				sendMsg = msgTemp.replace("${schemeName}", priceScheme.getName()).replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "195");
			noticeParamMap.put("noticeTempType", "NT36");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "价格方案失效流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(priceScheme.getMerchantId()));
			noticeParamMap.put("userCode", priceScheme.getUserCode());
			noticeParamMap.put("accessCode", priceScheme.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(priceScheme.getCreateUserId()));
			noticeParamMap.put("businessId", String.valueOf(priceScheme.getId()));
			noticeParamMap.put("projectCode", project.getProjectCode());
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, "");
			replaceValuesMap.put(MsgUtil.ROOM_NAME, "");
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, "");
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,"");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, String.valueOf(priceScheme.getId()));
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, priceScheme.getName());
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, priceScheme.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, priceScheme.getProjectCode(), project.getProjectName(), "NT36", "价格方案流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【价格方案失效】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【应收款延期】组装
	 * 
	 * @param payDeposit 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param timeType 延期时间类型
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assemblePaymentDelayNotice(Signed signed, List<User> userList, String type, String userName_fqr, String timeType, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (signed.getRoomId() != null && !"".equals(signed.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(signed.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(signed.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(signed.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 延期签约流程, 获取字典表dictionary_value = 'NT34' 的消息模板
			// 消息模板: 延期签约审核结果【${auditStatus}】房号：${roomName}；客户：${customer}
			String msgTemp = "";
			String yqqy = "";
			if("1".equals(timeType)){
				yqqy = "(15天内)";
			}else if("2".equals(timeType)){
				yqqy = "(15~30天)";
			}else if("3".equals(timeType)){
				yqqy = "(30天以上)";
			}
			if("1".equals(type)){
				msgTemp = "延期付款"+yqqy+"审核结果【${auditStatus}】房号：${roomName}；客户：${customer}；";
			}else{
				msgTemp = "【延期付款"+yqqy+"】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT35");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
						.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
						.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "193");
			noticeParamMap.put("noticeTempType", "NT34");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "应收款延期流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(signed.getMerchantId()));
			noticeParamMap.put("userCode", signed.getUserCode());
			noticeParamMap.put("accessCode", signed.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(signed.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(signed.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(signed.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(signed.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, signed.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, subscribe_yqqy.getProjectCode(), project.getProjectName(), "NT34", "延期签约流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【应收款延期】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
	/**
	 * 消息内容【认购更名审核】组装
	 * 
	 * @param signed 业务对象
	 * @param userList 用户列表
	 * @param type 1 审核结果 2 报备信息
	 * @param userName_fqr 发起人
	 * @param processInstanceId 流程ID
	 * @return
	 */
	public String assembleSubscribeRenameNotice(Subscribe subscribe_gm, List<User> userList, String type, String userName_fqr, String processInstanceId){
		Map<String, String> noticeParamMap = new HashMap<String, String>();
		try {
			// 房源
			String proName = "";
			if (subscribe_gm.getRoomId() != null && !"".equals(subscribe_gm.getRoomId())) {
				ProjectRoom project = projectRoomService.selectById(subscribe_gm.getRoomId());
				if (project != null) {
					proName = project.getCombinedName();
				}
			}
			// 客户
			String cusName = "";
			Customer customer = customerService.selectById(subscribe_gm.getCustomerId());
			if (customer != null) {
				cusName = customer.getCustomerName();
			}
			//逆向流程，从业务异常表获取审核状态
			BusinessAbnormaDto businessAbnormaDto=new BusinessAbnormaDto();
			businessAbnormaDto.setBusinessId(subscribe_gm.getId());
			BusinessAbnorma businessAbnorma = businessAbnormaService.selectByDto(businessAbnormaDto);
			// 更名流程, 获取字典表dictionary_value = 'NT33' 的消息模板
			// 消息模板: 更名审核结果【${auditStatus}】房号：${roomName}；客户：${customer}
			String msgTemp = "";
			if("1".equals(type)){
				msgTemp = "认购更名审核结果【${auditStatus}】房号：${roomName}；客户：${customer}";
			}else{
				//msgTemp = "【签约更名】：${roomName}；客户：${customer}；发起人：${userName}【审核通过】";
				msgTemp = ReportMessageEnum.RGGM.getDes();
			}
			String sendMsg = "";
			DictionaryDto dicDto = new DictionaryDto();
			dicDto.setDictionaryValue("NT33");
			Dictionary dic = dictionaryService.selectByDto(dicDto);
			if("1".equals(type)){
				if (dic != null) {
					msgTemp = dic.getDictionaryName();
				}
				sendMsg = msgTemp
					.replace("${auditStatus}", AuditStatusEnum.getByNo(businessAbnorma.getAuditStatus()).getDes())
					.replace("${roomName}", proName).replace("${customer}", cusName);
			}else{
				sendMsg = msgTemp
						.replace("${roomName}", proName)
						.replace("${customer}", cusName)
						.replace("${userName}", userName_fqr);
			}
			// 创建提醒消息及消息发送人信息
			noticeParamMap.put("noticeDicId", "192");
			noticeParamMap.put("noticeTempType", "NT33");
			noticeParamMap.put("sendMsg", sendMsg);
			noticeParamMap.put("title", "认购更名流程审核结果");
			noticeParamMap.put("merchantId", String.valueOf(subscribe_gm.getMerchantId()));
			noticeParamMap.put("userCode", subscribe_gm.getUserCode());
			noticeParamMap.put("accessCode", subscribe_gm.getAccessCode());
			noticeParamMap.put("createUserId", String.valueOf(subscribe_gm.getCreateUserId()));
			noticeParamMap.put("customerId", String.valueOf(subscribe_gm.getCustomerId()));
			noticeParamMap.put("businessId", String.valueOf(subscribe_gm.getId()));
			if("1".equals(type)){
				noticeParamMap.put("tempType", "2");
			}else{
				noticeParamMap.put("tempType", "3");
			}
			/*
			 * (ym) 提醒内容增加超链接 start
			 * */
			Map<String,String> replaceValuesMap=new HashMap<String,String>();
			replaceValuesMap.put(MsgUtil.ROOM_ID, String.valueOf(subscribe_gm.getRoomId()));
			replaceValuesMap.put(MsgUtil.ROOM_NAME, proName);
			replaceValuesMap.put(MsgUtil.CUSTOMER_ID, String.valueOf(customer.getId()));
			replaceValuesMap.put(MsgUtil.CUSTOMER_NAME,cusName);
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_ID, "");
			replaceValuesMap.put(MsgUtil.PRICE_SCHEME_NAME, "");
			replaceValuesMap.put(MsgUtil.BUSINESS_ID, subscribe_gm.getId()+"");
			replaceValuesMap.put(MsgUtil.NEXT_NODE_ID, "");
			replaceValuesMap.put(MsgUtil.PROCESS_INSTANCE_ID, processInstanceId+"");
	    	noticeParamMap.put("replaceValues", MsgUtil.getReplaceValues(replaceValuesMap));
	    	/*
			 * (ym) 提醒内容增加超链接 end
			 * */
	    	createNotice(noticeParamMap, userList);
			// 消息推送
			//pushMsg(noticeId, signed_tf.getProjectCode(), project.getProjectName(), "NT33", "更名流程审核结果");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("消息内容【认购更名审核】组装异常:{}",e);
		}
		return ResultEnum.SUCCESS.getNo();
	}
	
}
